<template>
    <div class="page">
        <div class="bg">
            <div class="line-1">未来体验中心VR/AR端</div>
            <div class="line-2">让视野更丰富</div>
            <div class="line">
                <div>版本：1.0.1</div>
                <div>更新时间：2024.01.20</div>
            </div>

            <div class="btn-group">
                <div class="btn-item btn-item-1">下载安装包</div>
                <div class="btn-item btn-item-2">查看安装视频</div>
            </div>
        </div>

        <div class="container">
            <div class="download-box">
                <div class="download-desc">
                    <div class="download-info">
                        <div class="download-desc__title">更新信息</div>
                        <div class="download-desc__content">
                            <p class="download-desc__item">
                                版本号：{{ detail.version }}
                            </p>
                            <p class="download-desc__item">
                                发布日期：{{ detail.time }}
                            </p>
                            <p class="download-desc__item">
                                文件大小：{{ formatFileSize(detail.size || 0) }}
                            </p>
                        </div>
                    </div>
                    <div class="download-ask">
                        <div class="download-desc__title">配置要求</div>
                        <div class="download-desc__content">
                            <p
                                class="download-desc__item"
                                v-for="demand in SplitDemand(detail.demand)"
                                :key="demand"
                            >
                                {{ demand }}
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="bg-1"></div>

        <div class="pic-list">
            <div class="pic-item" v-for="item in list" :key="item.id">
                <div class="pic-img">
                    <img
                        :src="
                            `${_oss_}images/mobile/vr-download/${item.id}.jpg` +
                            '?x-oss-process=image/watermark,image_' +
                            toBase64(
                                'water/logo_white.png?x-oss-process=image/resize,P_50'
                            ) +
                            ',g_center,t_50'
                        "
                    />
                </div>
                <div class="pic-info">{{ item.id }}、{{ item.content }}</div>
            </div>
        </div>
    </div>
</template>
<script setup>
import { useContent } from ".";
const { detail, list, GetInfo } = useContent();

const SplitDemand = (demand) => {
    return demand ? demand.split("\r\n") : [];
};

onMounted(async () => {
    await nextTick();
    GetInfo();
});
</script>
<style lang="scss" scoped>
.page {
    background-color: #f5f5f5;

    .bg {
        position: relative;
        width: 100%;
        height: 377px;
        background: url("https://yzpt-resources.oss-cn-hangzhou.aliyuncs.com/web/images/mobile/future-experience-center/vr/bg.jpg");
        background-size: 100% 100%;

        .line-1 {
            position: absolute;
            top: 111px;
            left: 50%;
            transform: translate(-50%);
            font-size: 30px;
            color: #fff;
            white-space: nowrap;
        }

        .line-2 {
            position: absolute;
            top: 163px;
            left: 50%;
            transform: translate(-50%);
            font-size: 30px;
            color: #fff;
            white-space: nowrap;
        }

        .line {
            display: flex;
            align-items: center;
            justify-content: space-between;
            position: absolute;
            left: 50%;
            top: 230px;
            width: 232px;
            height: 25px;
            background-image: url("https://yzpt-resources.oss-cn-hangzhou.aliyuncs.com/web/images/mobile/future-experience-center/vr/line-bg.png");
            background-size: 100% 100%;
            transform: translateX(-50%);
            font-size: 12px;
            padding: 0 16px;
            color: #333;
        }

        .btn-group {
            display: flex;
            position: absolute;
            left: 50%;
            bottom: 54px;
            transform: translateX(-50%);

            .btn-item {
                display: flex;
                align-items: center;
                justify-content: center;
                width: 127px;
                height: 35px;
                border-radius: 18px;
                user-select: none;
                cursor: pointer;
                font-size: 14px;

                &-1 {
                    color: #fff;
                    background-color: #ccc;
                    margin-right: 30px;
                }

                &-2 {
                    background: #fff;
                    color: #5085fb;
                }
            }
        }
    }

    .bg-1 {
        width: 100%;
        height: 100px;
        background: url("https://yzpt-resources.oss-cn-hangzhou.aliyuncs.com/web/images/mobile/vr-download/bg-1.jpg")
            no-repeat 50% 0 / cover;
    }

    .container {
        width: 351px;
        margin: 0 auto;
        transform: translateY(-30px);

        .tips {
            font-size: 16px;
            line-height: 28px;
            color: #333;
        }

        .download-box {
            background-color: #fff;
            padding: 15px 13px;
            border-radius: 8px;
        }

        .download-desc {
            &__title {
                color: #333;
                font-weight: bold;
                font-size: 16px;
            }

            &__content {
                display: flex;
                flex-wrap: wrap;
                white-space: pre-line;
            }

            &__item {
                margin-right: 50px;
                margin-top: 10px;
                color: #555;
                word-break: break-all;
                line-height: 22px;

                &:nth-of-type(2n) {
                    margin-right: 0px;
                }
            }
        }

        .download-ask {
            margin-top: 20px;
        }
    }

    .pic-list {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 15px;

        .pic-item {
            width: 168px;
            margin-bottom: 20px;

            &:nth-of-type(2n) {
                margin-right: 0;
            }

            .pic-img {
                width: 168px;
                height: 168px;
                overflow: hidden;

                img {
                    width: 100%;
                    height: 100%;
                }
            }

            .pic-info {
                margin-top: 10px;
                font-size: 14px;
            }
        }
    }
}
</style>
